package com.neiquan.neiquandemo.base;

import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.neiquan.neiquandemo.R;
import com.neiquan.neiquandemo.activity.MainActivity;
import com.neiquan.neiquandemo.fmanager.BaseFragment;


/**
 * 作者 : hjb
 * 时间 : 2016/4/26.
 */
public abstract class AppBaseFragment extends BaseFragment {

    protected void setTitleTv(int id) {
        TextView tv = (TextView) rootView.findViewById(R.id.title_tv);
        tv.setText(id);
    }

    protected void setHeadVisibility(int visibility) {
        rootView.findViewById(net.neiquan.applibrary.R.id.head_view).setVisibility(visibility);
    }

    protected void setTitleTv(String str) {
        TextView tv = (TextView) rootView.findViewById(R.id.title_tv);
        tv.setText(str);
    }

//    protected void setBackTv(String str) {
//        TextView tv = (TextView) view.findViewById(R.id.back_tv);
//        tv.setText(str);
//    }

    protected void setNextTv(String str) {
        TextView tv = (TextView) rootView.findViewById(R.id.next_tv);
        tv.setVisibility(View.VISIBLE);
        tv.setText(str);
        View iv = rootView.findViewById(R.id.next_img);
        iv.setVisibility(View.GONE);
    }

    protected TextView getNextTv() {

        return (TextView) rootView.findViewById(R.id.next_tv);
    }

    protected void setBackGone() {
        View tv = rootView.findViewById(R.id.ly_back);
        tv.setVisibility(View.GONE);
    }




    @SuppressLint("NewApi")
    protected void setNextTvBG(Drawable drawable) {
        TextView tv = (TextView) rootView.findViewById(R.id.next_tv);
        tv.setBackground(drawable);
    }

    protected void setNextImage(int id) {
        TextView tv = (TextView) rootView.findViewById(R.id.next_tv);
        tv.setVisibility(View.GONE);
        ImageView iv = (ImageView) rootView.findViewById(R.id.next_img);
        iv.setVisibility(View.VISIBLE);
        iv.setImageResource(id);
    }
    protected void setNextSearchImage(int id) {
        TextView tv = (TextView) rootView.findViewById(R.id.next_tv);
        tv.setVisibility(View.GONE);
        ImageView iv = (ImageView) rootView.findViewById(R.id.searh_next_img);
        iv.setVisibility(View.VISIBLE);
        iv.setImageResource(id);
    }
    protected void setNextOnClick(View.OnClickListener onClick) {
        TextView tv = (TextView) rootView.findViewById(R.id.next_tv);
        tv.setOnClickListener(onClick);
        View iv = rootView.findViewById(R.id.next_img);
        iv.setOnClickListener(onClick);
    }
    protected void setNextSearchOnClick(View.OnClickListener onClick) {
        View iv = rootView.findViewById(R.id.searh_next_img);
        iv.setOnClickListener(onClick);
    }
    protected void setNextGone() {
        TextView tv = (TextView) rootView.findViewById(R.id.next_tv);
        tv.setVisibility(View.GONE);
        ImageView iv = (ImageView) rootView.findViewById(R.id.next_img);
        iv.setVisibility(View.GONE);
    }



}
